﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace SharePoint.Log.Viewer._2010
{
    public partial class LogRow : UserControl
    {
        public LogRow()
        {
            InitializeComponent();
        }

        public LogRow(DateTime Timestamp, Guid Guid, string Message, string Area, string Level, string Process, string TID, string Category, string EventID)
        {
            InitializeComponent();

            lblTimestamp.Text = Timestamp.ToString();
            lblGuid.Text = Guid.ToString();
            lblMessage.Text = Message;
            lblMessage.Width = this.Width - 10;
            lblArea.Text = Area;
            lblLevel.Text = Level;
            lblProcess.Text = Process;
            lblTID.Text = TID;
            lblCategory.Text = Category;
            lblEventID.Text = EventID;

            switch (Level.ToLower())
            {
                case "high":
                    lblLevel.ForeColor = Color.Red;
                    break;
                case "medium":
                    lblLevel.ForeColor = Color.Blue;
                    break;
                case "low":
                    lblLevel.ForeColor = Color.Black;
                    break;
                default:
                    lblLevel.ForeColor = Color.Black;
                    break;
            }
        }
    }
}
